from threading import Timer
import numpy as np
import cv2
import time

lower_blue = np.array([0,0,0])
upper_blue = np.array([170,255,46])
cap = cv2.VideoCapture(0)

i = 0
time_interval = 1.0

def frame_rate():
	global i
	x = i
	print x
	i = 0
	t = Timer(time_interval,frame_rate)
	t.start()

t = Timer(time_interval,frame_rate)
t.start()


while(True):
	global i
	i = i + 1
	ret, frame = cap.read()
	cv2.imshow('frame',frame)
	if cv2.waitKey(1) & 0xFF == ord('q'):
		break
cap.release()
cv2.destroyAllWindows()
